/**
 * 
 */
package vn.smartware.co.framework.validator;

import java.io.Serializable;
import java.util.HashMap;

/**
 * ActionMessages
 */
@SuppressWarnings("rawtypes")
public class ActionMessages implements Serializable {

    /**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 7186217271882541500L;
	/**
     * messages
     */
    protected HashMap messages = new HashMap();
    
    /**
     * ActionMessages
     */
    public ActionMessages() {
        super();
    }
    
    /**
     * add
     * @param property
     * @param message
     */
    @SuppressWarnings("unchecked")
	public void add(String property, ActionMessage message) {
        messages.put(property, message);
    }
    
    /**
     * <p>Clear all messages recorded by this object.</p>
     */
    public void clear() {
        messages.clear();
    }
    
    /**
     * isEmpty
     * @return boolean
     */
    public boolean isEmpty() {
        return (messages.isEmpty());
    }
    
    /**
     * <p>Return the set of messages related to a specific property.
     * If there are no such messages, an empty enumeration is returned.</p>
     * @param property
     * @return ActionMessage
     */
    public ActionMessage get(String property) {
        return (ActionMessage)messages.get(property);
    }
}
